package com.java.code.thread;

import org.junit.Test;

import java.util.concurrent.locks.ReentrantLock;

public class JavaReentrantLock {
    /**
     * ReentrantLock锁基本应用
     */
    @Test
    public void reentrantLock() {
        ReentrantLock lock = new ReentrantLock();
        // 加锁
        lock.lock();
        System.out.println("加锁");
        try {
            //Do Some Thing
        } finally {
            //释放锁
            lock.unlock();
        }
    }
}
